using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MagicFrailty_UI : MonoBehaviour
{
    public CharacterStat characterStat;
    private Image slider;

    void Start()
    {
        slider = GetComponent<Image>();
    }

    void Update()
    {
        UpdateUI();
    }

    private void UpdateUI()
    {
        if (characterStat == null) return;

        int maxValue = characterStat.GetMaxMagicFrailty();
        float value = characterStat.GetMagicFrailty();
        slider.fillAmount = (maxValue - value) / maxValue;
    }
}
